import 'package:flutter/material.dart';
import 'package:zchope_student/const.dart';
import 'package:zchope_student/view/inputfield.dart';

class PlayerQuestion extends StatefulWidget {
  @override
  _PlayerQuestionState createState() => _PlayerQuestionState();
}

_setDiscuz() {
  List<Widget> list = List();
  for (int i = 0; i < 1; i++) {
    list.add(Text(
      '暂无数据',
      style: TextStyle(color: Const.gold, fontSize: 16),
    ));
  }
  return list;
}

class _PlayerQuestionState extends State<PlayerQuestion> {
  Map data = Map<String, String>();

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 8),
      child: Column(
        children: <Widget>[
          Expanded(
              child: ListView(
            children: _setDiscuz(),
          )),
          InputField(
            map: data,
            mapKey: 'discuss',
            icon: Icons.send,
            onTap: () {
            },
          ),
        ],
      ),
    );
  }
}

class DiscuzItem extends StatelessWidget {
  final title;
  final date;
  final content;

  const DiscuzItem({Key key, this.title, this.date, this.content})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: <Widget>[
        Text(
          title,
          style: TextStyle(color: Const.gold, fontSize: 16),
        ),
        SizedBox(
          height: 5,
        ),
        Text(
          date,
          style: TextStyle(color: Const.grey, fontSize: 12),
        ),
        SizedBox(
          height: 10,
        ),
        Text(
          content,
          style: TextStyle(color: Const.gold, fontSize: 16),
        ),
        SizedBox(
          height: 10,
        ),
        Divider(
          height: 1,
          color: Const.grey,
        )
      ],
    );
  }
}

//class CourseItem extends StatelessWidget {
//  final courseBean;
//
//  const CourseItem({Key key, this.courseBean}) : super(key: key);
//
//  @override
//  Widget build(BuildContext context) {
//    return Column(
//      crossAxisAlignment: CrossAxisAlignment.start,
//      children: <Widget>[
//        Text(
//          courseBean.title,
//          style: TextStyle(color: Const.gold, fontSize: 16),
//        ),
//        SizedBox(
//          height: 10,
//        ),
//        Courses(
//          dataList: courseBean.content,
//        ),
//        SizedBox(
//          height: 5,
//        ),
//        Divider(
//          height: 1,
//          color: Const.grey,
//        )
//      ],
//    );
//  }
//}
//
//class Courses extends StatelessWidget {
//  final dataList;
//
//  const Courses({Key key, this.dataList}) : super(key: key);
//
//  _setCourses() {
//    List<Widget> datas = List();
//    for (String course in dataList) {
//      datas.add(
//        Text(
//          course,
//          style: TextStyle(color: Const.gold, fontSize: 12),
//        ),
//      );
//    }
//    return dataList;
//  }
//
//  @override
//  Widget build(BuildContext context) {
//    return Column(
//      children: _setCourses(),
//    );
//  }
//}
